
	<!DOCTYPE html>
	<html>
		<head>
			<meta charset="UTF-8">
			<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
			<title>构件列表</title>
			<link rel="stylesheet" href="css/AllStyle.css" />
			<link rel="stylesheet" href="css/iconfont.css" />
			<script type="text/javascript" src="js/common.js" ></script>
			<script type="text/javascript" src="js/companydata.js" ></script>
			<script type="text/javascript" src="js/data.js" ></script>
			<script type="text/javascript" src="js/tmpl.js" ></script>
		</head>
		<body>
			<!-- 页头 -->
			<section>
				<script type="text/javascript">
					AllPageHeader()
				</script>
			</section>
			<section class="AllContent" id="AllContent" style="background-color: #fff;">
					<form>
						<div class="FormStyle">
							<div class="ScanInput" style="width:90%;margin:10px auto;">
								<p style="margin: 0px;"><input name="steelSpecification" id="steelSpecification" class="bg-focus form-control" type="text" placeholder="钢号,工程名称,制作班组"></p>
								<p style="margin: 0px;"><button type="button" style="font-size:0.9em" onclick="querySend();">查询</button></p>
							</div>
							<p class="TheResults" style="margin:0px 5%;padding:0px;padding-bottom:10px;"></p>
							<div class=""><p class="relative alert alert-success"></p></div>
						</div>
						<div class="grid-body" id="cententbody"></div>
					</form>

				<div id="sendList" style="background-color: #fff;">
					<img style="width: 40%;margin:20px auto;display: block;" src="images/loading5.gif">
				</div>
			</section>
			<div id="dddd"></div>
		</body>
		<script type="text/javascript" src="js/jquery.min.js" ></script>
		<script type="text/javascript" src="js/mui.min.js" ></script>
		<script type="text/javascript">
			mui.init();
			$('.AllHeader li:eq(1)').text("构件列表");
			$('.AllHeader li:eq(2)').html('<img style="width:28px" src="images/Scan.png">')
			mui.plusReady(function(){
				//扫描器
				document.getElementById('Scanner').addEventListener('tap', function() {
				  mui.openWindow({
					url: 'Scanner.html?etk=33',
					id:'Scanner.html'
				  });
				});
			});

			//添加refresh自定义事件监听
			window.addEventListener('frameList',function(){
				var id = event.detail.id;
				$('#steelSpecification').val(id);
				querySend();
			});

			//搜索客户发货单
			$(".serarchBtn").on('tap',function(){
			  querySend();
			});

			$(function(){
				if(getCookie("token") === null || getCookie("token") === ''){
					window.location.href='login.html';
					return;
				}
				querySend();
				var RequestTime=1,page_no=1,cishu=1,intZh=1,ptinfo=1;
				$("#AllContent").scroll(function(){
					var divHeight = $(this).height();
					var nScrollHeight = $(this)[0].scrollHeight;
					var nScrollTop = $(this)[0].scrollTop;
					var xiami = nScrollTop + divHeight;
					if(nScrollTop + divHeight >= nScrollHeight) {
						if(page_no == 1){
							var Pages = 2;
						}else{
							Pages = ++page_no
						}
						if(RequestTime == cishu){
							$('#sendList').append("<img id='LoadingImg' style='borderTop:3px solid #f3f3f3;width: 20%;margin:0px auto;display: block;' src='images/loading5.gif'><p style='text-align:center;color:#777;padding:0px 0px;'>正在加载...</p>");
							$(this).animate({scrollTop:xiami},800);
							RequestTime++;
							$.ajax({
								headers:{
									"X-Access-Token":getCookie("token")
								},
								type: "GET",
								url: getServerUrl()+"/quality/qualityTesting/reportList", //与此php页
								dataType: 'json', //从php返回的值以 JSON方式 解释
								contentType: 'application/json',
								data: 'pageSize=20'+'&pageNo='+Pages, //
								success: function (json) {//如果调用php成功
									sendlist = json.result.records;
									var ZLength = json.total/20;
									if(ZLength<1){
										RequestTime = 0;
										console.log(ZLength);
										return false;
									}
									UpwardRefresh(sendlist);
									showpage(json.total,0,20,getwindowhref());
									page_no = 0;
									cishu = 0;
									var ZLength = json.total/20;
									var Strlength = ZLength.toString();

									if(Strlength.substring(1)){
										intZh = Strlength.substring(0,1);
										console.log(intZh);
										intZh++;

									}
									if(0> ZLength){
										RequestTime = 0;
									}

								},
								error:function(json){
									alertMessage(json.errordescription);
								}
							});
						}else if(RequestTime == 0){
							if(ptinfo == 1){
								$('#sendList').append("<img id='LoadingImg' style='borderTop:3px solid #f3f3f3;width: 20%;margin:0px auto;display: block;' src='images/loading5.gif'><p style='text-align:center;color:#777;padding:0px 0px;'>正在加载...</p>");
								$(this).animate({scrollTop:xiami},800);

								setTimeout(function () {
									$('#LoadingImg').attr('src','images/loading5_.jpg');
									$('#LoadingImg').next().text('没有更多数据...');
								}, 1500);

								setTimeout(function () {
									$('#LoadingImg').next().hide(500);
									$('#LoadingImg').hide(500);
								}, 2500);
								ptinfo++;
							}
						}
					}
				});
			});
			function querySend() {
				var steelSpecification = $("#steelSpecification").val();
				var myData = {'pageSize':20,'pageNo':1};
				if(steelSpecification !== undefined && steelSpecification !== ''){
					myData = {'steelSpecification':steelSpecification,'pageSize':20,'pageNo':1};
				}
				$.ajax({
					headers:{
						"X-Access-Token":getCookie("token")
					},
					type: "GET",
					url: getServerUrl()+"/frame/inPhoneList", //与此php页
					dataType: 'json', //从php返回的值以 JSON方式 解释
					contentType: 'application/json',
					data: myData, //
					success: function (json) {//如果调用php成功
						sendlist = json.result.records;
						var chtml = '';
						if (!empty(sendlist)) {
							for (var i = 0; i < sendlist.length; i++) {
								if (!empty(sendlist[i])) {
									chtml = chtml + '<a href="frame.html?id='+sendlist[i].id+'">';
									chtml = chtml + '<div class="ProductsListContent">';
									chtml = chtml + '<div class="ProductsDetails">';
									chtml = chtml + '<p>构件钢号：' + sendlist[i].steelSpecification + '</p>';
									chtml = chtml + '<p>工程名称：' + sendlist[i].engineName + '</p>';
									chtml = chtml + '<p>制作班组：' + sendlist[i].workGroupName + '</p>';
									chtml = chtml + '<p>派单时间：' + sendlist[i].dispatchTime + '</p>';
									chtml = chtml + '<p>交付时间：' + sendlist[i].payTime + '</p>';
									chtml = chtml + '<span style="width: 100%;padding-top:10px;height:40px;margin-top:10px;background-color:#00a9ed;float:left;color:#ffffff;text-align:center;font-size:20px;">详情</span>';
									chtml = chtml + '</li>';
									chtml = chtml + '</ul>';
									chtml = chtml + '</div>';
									chtml = chtml + '</div>';
									chtml = chtml + '</a>';
								}
							}
						}
						$("#sendList").html(chtml);
						showpage(json.total_results,json.page_no,json.page_size,getwindowhref());
					},
					error:function(json){
						window.location.href='login.html';
					}
				});
				var oTxt=document.getElementById("steelSpecification");
				oTxt.value="";
			}

			function UpwardRefresh(sendList) {
				var chtml = '';
				if (!empty(sendlist)) {
					for (var i = 0; i < sendlist.length; i++) {
						if (!empty(sendlist[i])) {
							chtml = chtml + '<a href="quality.html?id='+sendlist[i].id+'' +
									'&steelSpecification=' + sendlist[i].steelSpecification +
									'&reportCount=' + sendlist[i].reportCount +
									'&inProcCount=' + sendlist[i].inProcCount +
									'&qualifiedCount=' + sendlist[i].qualifiedCount +
									'&noQualifiedCount=' + sendlist[i].noQualifiedCount +
									'&procName=' + sendlist[i].procName +
									'&engineName=' + sendlist[i].engineName +
									'&realName=' + sendlist[i].realName +
									'&reportTime=' + sendlist[i].reportTime +
									'&framCount=' + sendlist[i].framCount +
									'&status=' + sendlist[i].status +
									'">';
							chtml = chtml + '<div class="ProductsListContent">';
							chtml = chtml + '<div class="ProductsDetails">';
							chtml = chtml + '<p>工程名称：' + sendlist[i].engineName + '</p>';
							chtml = chtml + '<p>工序名称：' + sendlist[i].procName + '</p>';
							chtml = chtml + '<p>报工单号：' + sendlist[i].steelSpecification + '</p>';
							chtml = chtml + '<p>报工时间：' + sendlist[i].reportTime + '</p>';
							chtml = chtml + '<p>报工数量：' + sendlist[i].reportCount + '</p>';
							chtml = chtml + '<p>在制数量：' + sendlist[i].inProcCount + '</p>';
							chtml = chtml + '<p>已检数量：' + sendlist[i].qualifiedCount + '</p>';
							chtml = chtml + '<span style="width: 100%;padding-top:10px;height:40px;margin-top:10px;background-color:#00a9ed;float:left;color:#ffffff;text-align:center;font-size:20px;">质检</span>';
							chtml = chtml + '</li>';
							chtml = chtml + '</ul>';
							chtml = chtml + '</div>';
							chtml = chtml + '</div>';
							chtml = chtml + '</a>';


						}
					}
				}
				$('#LoadingImg').next().remove();
				$('#LoadingImg').remove();
				$("#sendList").append(chtml);
			}
		</script>
		<style>
			p{
				margin-top: 10px;
			}
		</style>
	</html>
